package com.yyn.seckill.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;


@Configuration
public class RabbitMQTopicConfig {
    private static final String QUEUE  = "seckillQueue";
    private static final String EXCHANGE  = "seckillExchange";

    @Bean
    public  Queue seckillQueue(){
        return new Queue(QUEUE);
    }
    @Bean
    public TopicExchange seckillExchange(){
        return new TopicExchange(EXCHANGE);
    }
    @Bean
    public Binding binding(){
        return BindingBuilder.bind(seckillQueue()).to(seckillExchange()).with("seckinll.#");
    }
}
